package com.monkey.internalcommon.util;

/**
 * @author tao
 * @date 2022/6/20 22:49
 */
public class RedisPrefixUtils {

    // 乘客验证码的前缀
    public static String verificationCodePrefix = "passenger-verification-code-";

    // token 存储的前缀
    public static String tokenPrefix = "token-";

    /**
     * 根据手机号和身份标识生成token
     * @param phone
     * @param identity
     * @param tokenType
     * @return
     */
    public static String generatorTokenKey(String phone, String identity, String tokenType) {
        return tokenPrefix + phone + "-" + identity + "-" + tokenType;
    }

    /**
     * 根据手机号生成key
     * @param passengerPhone 手机号
     * @return
     */
    public static String generatorKeyByPhone(String passengerPhone) {
        return verificationCodePrefix + passengerPhone;
    }
}
